package com.aliyun.miniappdemo.data;

/**
 * Result
 *
 * @author solution
 * @date 2024/05/11
 */
public class Result<T> {
    private Boolean success;

    private Integer code;

    private String message;
    private T data;

    public Result(T data) {
        this.success = true;
        this.code = 200;
        this.message = "success";
        this.data = data;
    }

    public Result(Boolean success, Integer code, String message, T data) {
        this.success = success;
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

    public static <T> Result<T> success(T data) {
        return new Result<>(data);
    }
}
